package com.example.yls.videoview;

import android.app.Activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;
/*继承Activity 实现全屏*/
public class MainActivity extends Activity {
    private VideoView myVideo;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        myVideo=findViewById(R.id.my_video);
        //以文件路径的方式设置VideoView播放的视频源。 需要在配置文件添加权限
        myVideo.setVideoPath("/mnt/shared/Other/family.mp4");
        //在当前文件设置MediaController控制器，视频控制条
        myVideo.setMediaController(new MediaController(MainActivity.this));
        //开始播放
        myVideo.start();
    }
}
